Skip to content

Add eject command to decouple from update mechanism#2

Merged
mrsthl merged 3 commits intomainfrom
claude/add-eject-command-Fl2yS
Mar 25, 2026
Merged

Add eject command to decouple from update mechanism#2
mrsthl merged 3 commits intomainfrom
claude/add-eject-command-Fl2yS

Conversation

@mrsthl
Copy link
Copy Markdown
Owner

@mrsthl mrsthl commented Mar 25, 2026

Summary

  • Adds /5:eject command that permanently removes update infrastructure from the installation
  • Deletes: check-updates.js hook, update.md command, eject.md command, version.json, .update-cache.json
  • Removes the check-updates.js hook entry from .claude/settings.json
  • All other workflow files (commands, skills, templates, etc.) remain untouched
  • Irreversible — to restore updates, reinstall with npx 5-phase-workflow

Test plan

  • npm test — all existing tests pass
  • Run /5:eject and verify all update files are deleted
  • Verify settings.json no longer contains check-updates hook entry
  • Verify statusline no longer shows update indicator (no version.json)
  • Verify reinstalling with npx 5-phase-workflow restores full functionality

https://claude.ai/code/session_01UTjW3dbQ44EZmQtuNj9GUM

Summary by CodeRabbit

  • New Features

    • Added 5:eject command enabling permanent removal of the update mechanism from installations, with automatic cleanup of related files and settings, user confirmation, and reinstallation instructions.
  • Documentation

    • Updated CLI help output to include the new command.

Adds /5:eject command that sets ejected flag in .5/version.json.
When ejected, update checks, statusline indicators, /5:update,
and --upgrade installs are all skipped. Reversible by removing
the ejected field from version.json.

https://claude.ai/code/session_01UTjW3dbQ44EZmQtuNj9GUM
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 25, 2026

Warning

Rate limit exceeded

@mrsthl has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 18 minutes and 41 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 314202c8-c11f-4ae5-9287-a92d9520e5f4

📥 Commits

Reviewing files that changed from the base of the PR and between 5417a3b and e61b43a.

📒 Files selected for processing (1)
  • README.md
📝 Walkthrough

Walkthrough

A new 5:eject command is introduced to permanently remove the update mechanism from an installation. The CLI help output is updated to list this command. The workflow reads version information, requests user confirmation, deletes update-related files, removes update hook entries from settings, and reports successful ejection.

Changes

Cohort / File(s) Summary
CLI Help Output
bin/install.js
Updated showCommandsHelp() to include /5:eject entry in command list.
New Eject Command
src/commands/5/eject.md
New command definition that removes update mechanism via multi-step workflow: reads .5/version.json for version info and existence check, requests confirmation, deletes update-related files and directories, updates .claude/settings.json to remove check-updates.js hook from SessionStart array, and reports successful ejection.

Sequence Diagram

sequenceDiagram
    participant User
    participant Eject as 5:eject Command
    participant FileSystem as File System
    participant SettingsFile as .claude/settings.json
    
    User->>Eject: Invoke 5:eject
    Eject->>FileSystem: Read .5/version.json
    alt File exists
        FileSystem-->>Eject: Version data
        Eject->>User: Request confirmation<br/>(show files to be deleted)
        alt User confirms
            User-->>Eject: Confirmed
            Eject->>FileSystem: Delete update files<br/>(.5/ directory, hooks, cache)
            FileSystem-->>Eject: Deleted
            Eject->>SettingsFile: Read settings
            SettingsFile-->>Eject: Settings data
            Eject->>Eject: Remove check-updates.js<br/>from hooks.SessionStart
            Eject->>SettingsFile: Write updated settings
            SettingsFile-->>Eject: Written
            Eject->>User: Report success<br/>(show version, reinstall command)
        else User cancels
            User-->>Eject: Cancelled
            Eject->>User: Abort
        end
    else File not found
        FileSystem-->>Eject: Not found
        Eject->>User: Report: Already ejected
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 Hop hop, the update chains fall away,
No more checks on the break of day,
With /5:eject spoken true,
Freedom flows through and through!

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: adding an eject command to decouple from the update mechanism.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/add-eject-command-Fl2yS

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (2)
src/hooks/check-updates.js (1)

42-45: Consider strict equality check for consistency.

The check uses truthy evaluation (if (versionData.ejected)), while bin/install.js (line 86) uses strict equality (data.ejected === true). For consistency across the codebase and to guard against unexpected truthy values, consider aligning with the stricter pattern.

Suggested change
   // Skip if ejected
-  if (versionData.ejected) {
+  if (versionData.ejected === true) {
     process.exit(0);
   }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/hooks/check-updates.js` around lines 42 - 45, Change the loose truthy
check on versionData.ejected to a strict boolean comparison: replace the if
(versionData.ejected) branch with if (versionData.ejected === true) to match the
pattern used elsewhere (e.g., bin/install.js) so the ejected check only triggers
on an explicit true value; update the conditional around process.exit(0)
accordingly in the file containing the versionData.ejected check.
src/hooks/statusline.js (1)

53-68: Consider strict equality check for consistency.

Same observation as in check-updates.js: this uses truthy evaluation while bin/install.js uses data.ejected === true. For consistency, consider using versionData.ejected !== true instead.

Suggested change
       // Skip update indicator if ejected
-      if (!versionData.ejected) {
+      if (versionData.ejected !== true) {
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/hooks/statusline.js` around lines 53 - 68, Replace the truthy negation
check for ejection with a strict boolean comparison: in the block that reads
cacheFile and sets updateIndicator, change the condition from if
(!versionData.ejected) to if (versionData.ejected !== true) so it matches the
explicit style used elsewhere (refer to the symbol versionData.ejected), leaving
the rest of the logic that reads cacheFile, parses latest, compares via
compareVersions(installed, latest) and sets updateIndicator unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@src/hooks/check-updates.js`:
- Around line 42-45: Change the loose truthy check on versionData.ejected to a
strict boolean comparison: replace the if (versionData.ejected) branch with if
(versionData.ejected === true) to match the pattern used elsewhere (e.g.,
bin/install.js) so the ejected check only triggers on an explicit true value;
update the conditional around process.exit(0) accordingly in the file containing
the versionData.ejected check.

In `@src/hooks/statusline.js`:
- Around line 53-68: Replace the truthy negation check for ejection with a
strict boolean comparison: in the block that reads cacheFile and sets
updateIndicator, change the condition from if (!versionData.ejected) to if
(versionData.ejected !== true) so it matches the explicit style used elsewhere
(refer to the symbol versionData.ejected), leaving the rest of the logic that
reads cacheFile, parses latest, compares via compareVersions(installed, latest)
and sets updateIndicator unchanged.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 2892f2bb-3fa1-4233-9d1e-e706c982c06f

📥 Commits

Reviewing files that changed from the base of the PR and between 00e852c and a8ca8b6.

📒 Files selected for processing (5)
  • bin/install.js
  • src/commands/5/eject.md
  • src/commands/5/update.md
  • src/hooks/check-updates.js
  • src/hooks/statusline.js

claude added 2 commits March 25, 2026 19:37
Eject now permanently removes update-related files:
- .claude/hooks/check-updates.js
- .claude/commands/5/update.md and eject.md
- .5/version.json and .update-cache.json
- check-updates hook entry from settings.json

Reverts the flag-based approach (ejected field in version.json).
To restore updates after eject, reinstall with npx 5-phase-workflow.

https://claude.ai/code/session_01UTjW3dbQ44EZmQtuNj9GUM
Documents /5:eject in the commands table, project structure,
and a new Ejecting subsection under Updating.

https://claude.ai/code/session_01UTjW3dbQ44EZmQtuNj9GUM
@mrsthl mrsthl merged commit 81b4ede into main Mar 25, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants